import CryptoJS from 'crypto-js'
import { KEY, IV } from '@/config'
const key = CryptoJS.enc.Utf8.parse(KEY)
const iv = CryptoJS.enc.Utf8.parse(IV)

// Encrypts text and encodes it with Base64
export function encrypt(text: string) {
  let encrypted = CryptoJS.AES.encrypt(text, key, {
    iv: iv,
    mode: CryptoJS.mode.CFB,
    padding: CryptoJS.pad.NoPadding
  })
  return encrypted.toString()
}
